package hy.config;

import com.alipay.api.DefaultAlipayClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AliCfg {
    //用于产生alipayClient实例并注入配置
    @Bean(name="alipayClient")
    public DefaultAlipayClient alipayClient(){
        DefaultAlipayClient alipayClient =
                new DefaultAlipayClient("https://openapi.alipaydev.com/gateway.do"
                        ,"2016100100639965"
                        ,"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCVlcs3ab0b+qBbaPDc6bFk1DXyEgZrKhSKuOrUQZSpIXViLSZLx/mwgO1zMagSS4B+4S5KrqAv0tU5rGHf9pWcJPmRtehCrMf36SwY9H1MHTh77Y9uijuo7Zwwshv9Dzk257A3rAHPwX03pE2kSvEcDTcPDJt9GmnRjLSAbKjGxSw7bUqCdz8tD13vHmo50I9likH5RbXGrz6kuXU4SsWB5qCa6CAvgBVs05VblTDV0kuXOtPnWgmIuK5hat/VWqebiobDAs7/5Mhv4QTJsGxF7wAmJGd1gom++N67h74unNTqrxsf8zBXx0lCOV1l3o+gUoKb3X+b94ZcpPS13+GVAgMBAAECggEAFwHTH9LDo2oJAAZEBbZr8nYxVeov0ovGXQ/UDpGHq/vZciA/o6g+X0d1PiKFF0tFmD5KQHJbcP+cjCJXa3shx8JoIGE6OAcbOqZCghQYsXxNE8KWLQpV4sWpIFREucd9pVQ9ZlKudKXt/IDo8DwWmZnuvgHSaIuHexOJL7eGvguYn4KlJDAcGoWTdOBJTfAtW3A21uXFJegyaNV3IOQbUWcrr99g3kt0jfYjmpzPrImkDYlD9DkiCr0HlS0SNhfV1XnZjLcSW2ezOTqNkZA7xKMmn8aht4wDTlIxFEyHG4SX8McyVzgm8Oh842YjTk0BFBll+/xQIn7JF3FaukDkAQKBgQDmmUHsyLEns/KOm64vDgNpmqiCb74BqGxkHyVvCUlXG0wpPizjbnBaHWzAEHepDX+FHAWsrtrUsWm53dTS4XpKd3VRtFiKnzESQpnU3IhbMK3LAx03bjEqt8HL/oxArRl0li7rgQr8lNPVIrUS4E10wEIVdcyZkkO3EDOYCkdHrQKBgQCmEAD8103OD2tJXyCiBcUj30LOzEHpdbGTYm6kF47v4uIOwGmK1RDg3IolUztWyH49W/yiAH6kFRjaC5hNE1EGqCeEiPXfIkZwQt79Ozs7oEDr622MuPM6mcR/eZbVErBkqdshCEqV3jDeSOM031yzonB5m9lTyE69qttdMC1eiQKBgBfMwY0auY4LeIFXeAbLP3bqy3GK7uVk6Kr8u/RV1Qf0fUvUavWeNGJYnxzDllYQWpT2a2+DLHq/RNY2Gv0Y4HJHGgiwwGKuQ3ZLAW2CxWAECivlymIqMVDjXlEbmIYkV3g89+K+ks+23JYm2uFz3QqrvSZR3igLfImsVmbeyLSRAoGAQX+EdDWTmZfZUCo2G9G8zQZNOnWz9ZoXPTOQwiYMma9aTEk2F60sKBS0ZD5s5DDWIet7PIaHbL5pe+8g1h2tUrvWQl8m4yiIsdSeUTEgjscJdEP6hIuaW920dDcH9+iULFAWfvPfPzdQ/QuwmfUTgkKqrDx9Pp999y9BsILFEkkCgYEA5fUSmrX9I7zoF0o58H0yuz5fJyxLzsfv7x/iffJS7QLXNBpK4i4fMTGaklyBLqHsioZv0m/dggudNqo+/rLD3zXFb1ZaxOxFTXvECb7VatwpCVeNxaPeaCUUkBa+SpEANwSF/nW028JEE9WkSixVoGHiSSLwodP+0PbvLm5xKhg="//应用私钥需要每个人自行进行保护
                        ,"json"
                        ,"utf-8"
                        ,"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgi2aVVSiPD0Dxw5Avy+NTIWmAqLxnuBl72wiW31R1L62v6t80Gqi9xcDKgsNPx+zDAgyntLLGl3gQt0eIjOTol/ZKMK2NHbga1DOu1AEAqFGC943MZORknpMVvNaXKzkIrK0V7t6o3pBmbsYzgPHXCCSvNLhjGLio7/TPtXEyg5WTHfZb4sq0adHf6Rcarc+NytR7QhaWu/kkg84Deee3Q0TYLRCt2YyDTZg/4upHHSnKnsE/0KgRjwZkaXwvhzoHSOIhJJM0FhWMUgavwFHjiol1LcppfPhH9cJIZMorB+Z1Z9P4ACTHFKMPRhRVyYrjPdqpaQipknaOXt70xDHQIDAQAB"//支付宝公钥
                        ,"RSA2");//RSA2是加密方式
        return alipayClient;
    }
}